extends SceneTree

func _init():
	# 加载主场景
	var main_scene = load("res://scenes/main.tscn")
	var main_instance = main_scene.instantiate()
	
	# 查找Player节点
	var player = main_instance.get_node("Player")
	if player:
		# 查找并移除Camera2D2节点
		var camera = player.get_node("Camera2D2")
		if camera:
			print("找到Camera2D2节点，正在移除...")
			player.remove_child(camera)
			camera.queue_free()
			
			# 保存修改后的场景
			var packed_scene = PackedScene.new()
			packed_scene.pack(main_instance)
			ResourceSaver.save(packed_scene, "res://scenes/main.tscn")
			print("场景已保存，Camera2D2节点已移除")
		else:
			print("未找到Camera2D2节点")
	else:
		print("未找到Player节点")
	
	quit() 